package mytools;

import android.app.Application;
import android.content.Context;
import android.util.ArrayMap;
import android.util.SparseArray;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.socks.library.KLog;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import gov.kqqzyyy.monkey.ydhl.BuildConfig;
import objects.InPatient;
import objects.LoginUser;
import objects.Section;

/**
 * Created by Monkey on 2017/12/20.
 * 自定义Application，存储全局变量
 */

public class MyApplication extends Application {

    private ArrayMap<String, String> deviceInfos;// 用来存储设备信息和异常信息
    private long deltaTime = 0;//与服务器时间差
    public static Context applicationContext;

    private InPatient choosePatient;
    private LoginUser loginUser;

    private Section currentSection;
    private ArrayMap<Section, List<InPatient>> mDataMap;

    @Override
    public void onCreate() {
        super.onCreate();
//        CrashHandler.getInstance().init(this);
        Fresco.initialize(this);
        KLog.init(BuildConfig.LOG_DEBUG);
        applicationContext = this;
    }

    public long getDeltaTime() {
        return deltaTime;
    }

    public void setDeltaTime(long deltaTime) {
        this.deltaTime = deltaTime;
    }

    public ArrayMap<String, String> getDeviceInfos() {
        if (deviceInfos == null) {
            return new ArrayMap<>();
        }
        return deviceInfos;
    }

    public void setDeviceInfos(ArrayMap<String, String> deviceInfos) {
        this.deviceInfos = deviceInfos;
    }

    public InPatient getChoosePatient() {
        return choosePatient;
    }

    public void setChoosePatient(InPatient choosePatient) {
        this.choosePatient = choosePatient;
    }

    public LoginUser getLoginUser() {
        return loginUser;
    }

    public void setLoginUser(LoginUser loginUser) {
        this.loginUser = loginUser;
    }

    public ArrayMap<Section, List<InPatient>> getmDataMap() {
        return mDataMap;
    }

    public void setmDataMap(ArrayMap<Section, List<InPatient>> mDataMap) {
        this.mDataMap = mDataMap;
    }

    public Section getCurrentSection() {
        return currentSection;
    }

    public void setCurrentSection(Section currentSection) {
        this.currentSection = currentSection;
    }
}
